home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1993 July / InfoMagic USENET CD-ROM July 1993.ISO / sources / unix / volume6 / xlisp1.6 / part6 < prev    next >
Encoding:
Internet Message Format  |  1986-11-30  |  57.2 KB

  1. Subject:  v06i112:  Xlisp version 1.6 (xlisp1.6), Part06/06
  2. Newsgroups: mod.sources
  3. Approved: rs@mirror.UUCP
  4.  
  5. Submitted by: seismo!utah-cs!b-davis (Brad Davis)
  6. Mod.sources: Volume 6, Issue 112
  7. Archive-name: xlisp1.6/Part06
  8.  
  9. [  This is the last article in Volume 6; Volume 7 will start in
  10.    a couple of days because I want to re-think some of the organization
  11.    details. --r$ ]
  12.  
  13. #! /bin/sh
  14. # This is a shell archive, meaning:
  15. # 1. Remove everything above the #! /bin/sh line.
  16. # 2. Save the resulting text in a file.
  17. # 3. Execute the file with /bin/sh (not csh) to create the files:
  18. #    xlisp.doc
  19. # This archive created: Mon Jul 14 10:33:45 1986
  20. export PATH; PATH=/bin:$PATH
  21. if test -f 'xlisp.doc'
  22. then
  23.     echo shar: will not over-write existing file "'xlisp.doc'"
  24. else
  25. cat << \SHAR_EOF > 'xlisp.doc'
  26.  
  27.  
  28.  
  29.  
  30.  
  31.  
  32.                 XLISP: An Experimental Object-oriented Language
  33.  
  34.                                   Version 1.6
  35.  
  36.                                 January 6, 1986
  37.  
  38.  
  39.                                        by
  40.                                David Michael Betz
  41.                                114 Davenport Ave.
  42.                              Manchester, NH  03103
  43.  
  44.                              (603) 625-4691 (home)
  45.  
  46.                    Copyright (c) 1986, by David Michael Betz
  47.                               All Rights Reserved
  48.            Permission is granted for unrestricted non-commercial use
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73.  
  74.  
  75.  
  76.  
  77.  
  78.  
  79.  
  80.  
  81.  
  82.  
  83.  
  84.  
  85.  
  86.  
  87.  
  88.  
  89.  
  90.  
  91.  
  92.  
  93.  
  94.  
  95.         XLISP                  TABLE OF CONTENTS                  Page 2
  96.  
  97.  
  98.                                Table of Contents
  99.  
  100.  
  101.                 TABLE OF CONTENTS                        2
  102.  
  103.                 INTRODUCTION                             4
  104.  
  105.                 A NOTE FROM THE AUTHOR                   5
  106.  
  107.                 XLISP COMMAND LOOP                       6
  108.  
  109.                 BREAK COMMAND LOOP                       7
  110.  
  111.                 DATA TYPES                               8
  112.  
  113.                 THE EVALUATOR                            9
  114.  
  115.                 LEXICAL CONVENTIONS                     10
  116.  
  117.                 READTABLES                              11
  118.  
  119.                 OBJECTS                                 12
  120.  
  121.                 SYMBOLS                                 15
  122.  
  123.                 EVALUATION FUNCTIONS                    16
  124.  
  125.                 SYMBOL FUNCTIONS                        17
  126.  
  127.                 PROPERTY LIST FUNCTIONS                 19
  128.  
  129.                 ARRAY FUNCTIONS                         20
  130.  
  131.                 LIST FUNCTIONS                          21
  132.  
  133.                 DESTRUCTIVE LIST FUNCTIONS              24
  134.  
  135.                 PREDICATE FUNCTIONS                     25
  136.  
  137.                 CONTROL CONSTRUCTS                      27
  138.  
  139.                 LOOPING CONSTRUCTS                      29
  140.  
  141.                 THE PROGRAM FEATURE                     30
  142.  
  143.                 DEBUGGING AND ERROR HANDLING            31
  144.  
  145.                 ARITHMETIC FUNCTIONS                    32
  146.  
  147.                 BITWISE LOGICAL FUNCTIONS               34
  148.  
  149.                 RELATIONAL FUNCTIONS                    35
  150.  
  151.                 STRING FUNCTIONS                        36
  152.  
  153.  
  154.  
  155.  
  156.  
  157.  
  158.  
  159.  
  160.  
  161.         XLISP                  TABLE OF CONTENTS                  Page 3
  162.  
  163.  
  164.                 INPUT/OUTPUT FUNCTIONS                  37
  165.  
  166.                 FILE I/O FUNCTIONS                      38
  167.  
  168.                 SYSTEM FUNCTIONS                        39
  169.  
  170.  
  171.  
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.  
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202.  
  203.  
  204.  
  205.  
  206.  
  207.  
  208.  
  209.  
  210.  
  211.  
  212.  
  213.  
  214.  
  215.  
  216.  
  217.  
  218.  
  219.  
  220.  
  221.  
  222.  
  223.  
  224.  
  225.  
  226.  
  227.         XLISP                     INTRODUCTION                    Page 4
  228.  
  229.  
  230.         INTRODUCTION
  231.  
  232.         XLISP is an experimental programming language combining some of
  233.         the features of LISP with an object-oriented extension
  234.         capability.  It was implemented to allow experimentation with
  235.         object-oriented programming on small computers.  There are
  236.         currently implementations running on the the VAX under VAX/VMS,
  237.         on the 8088/8086 under MS-DOS, on the 68000 under CP/M-68K, on
  238.         the Macintosh, on the Atari 520ST and on the Amiga.  It is
  239.         completely written in the programming language 'C' and is easily
  240.         extended with user written built-in functions and classes.  It
  241.         is available in source form free of charge to non-commercial
  242.         users.
  243.  
  244.         Many traditional LISP functions are built into XLISP.  In
  245.         addition, XLISP defines the objects 'Object' and 'Class' as
  246.         primitives.  'Object' is the only class that has no superclass
  247.         and hence is the root of the class heirarchy tree.  'Class' is
  248.         the class of which all classes are instances (it is the only
  249.         object that is an instance of itself).
  250.  
  251.         This document is a brief description of XLISP.  It assumes some
  252.         knowledge of LISP and some understanding of the concepts of
  253.         object-oriented programming.
  254.  
  255.         A recommended text for learning LISP programming is the book
  256.         "LISP" by Winston and Horn and published by Addison Wesley.  The
  257.         first edition of this book is based on MacLisp and the second
  258.         edition is based on Common Lisp.  Future versions of XLISP will
  259.         continue to migrate towards compatibility with Common Lisp.
  260.  
  261.  
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268.  
  269.  
  270.  
  271.  
  272.  
  273.  
  274.  
  275.  
  276.  
  277.  
  278.  
  279.  
  280.  
  281.  
  282.  
  283.  
  284.  
  285.  
  286.  
  287.  
  288.  
  289.  
  290.  
  291.  
  292.  
  293.         XLISP                A NOTE FROM THE AUTHOR               Page 5
  294.  
  295.  
  296.         A NOTE FROM THE AUTHOR
  297.  
  298.         If you have any problems with XLISP, feel free to contact me for
  299.         help or advice.  Please remember that since XLISP is available
  300.         in source form in a high level language, many users have been
  301.         making versions available on a variety of machines.  If you call
  302.         to report a problem with a specific version, I may not be able
  303.         to help you if that version runs on a machine to which I don't
  304.         have access.  Please have the version number of the version that
  305.         you are running readily accessible before calling me.
  306.  
  307.         If you find a bug in XLISP, first try to fix the bug yourself
  308.         using the source code provided.  If you are successful in fixing
  309.         the bug, send the bug report along with the fix to me.  If you
  310.         don't have access to a C compiler or are unable to fix a bug,
  311.         please send the bug report to me and I'll try to fix it.
  312.  
  313.         Any suggestions for improvements will be welcomed.  Feel free to
  314.         extend the language in whatever way suits your needs.  However,
  315.         PLEASE DO NOT RELEASE ENHANCED VERSIONS WITHOUT CHECKING WITH ME
  316.         FIRST!!  I would like to be the clearing house for new features
  317.         added to XLISP.  If you want to add features for your own
  318.         personal use, go ahead.  But, if you want to distribute your
  319.         enhanced version, contact me first.  Please remember that the
  320.         goal of XLISP is to provide a language to learn and experiment
  321.         with LISP and object-oriented programming on small computers.  I
  322.         don't want it to get so big that it requires megabytes of memory
  323.         to run.
  324.  
  325.  
  326.  
  327.  
  328.  
  329.  
  330.  
  331.  
  332.  
  333.  
  334.  
  335.  
  336.  
  337.  
  338.  
  339.  
  340.  
  341.  
  342.  
  343.  
  344.  
  345.  
  346.  
  347.  
  348.  
  349.  
  350.  
  351.  
  352.  
  353.  
  354.  
  355.  
  356.  
  357.  
  358.  
  359.         XLISP                 XLISP COMMAND LOOP                  Page 6
  360.  
  361.  
  362.         XLISP COMMAND LOOP
  363.  
  364.         When XLISP is started, it first tries to load "init.lsp" from
  365.         the default directory.  It then loads any files named as
  366.         parameters on the command line (after appending ".lsp" to their
  367.         names).  It then issues the following prompt:
  368.  
  369.         >
  370.  
  371.         This indicates that XLISP is waiting for an expression to be
  372.         typed.  When an incomplete expression has been typed (one where
  373.         the left and right parens don't match) XLISP changes its prompt
  374.         to:
  375.  
  376.         n>
  377.  
  378.         where n is an integer indicating how many levels of left parens
  379.         remain unclosed.
  380.  
  381.         When a complete expression has been entered, XLISP attempts to
  382.         evaluate that expression.  If the expression evaluates
  383.         successfully, XLISP prints the result of the evaluation and then
  384.         returns to the initial prompt waiting for another expression to
  385.         be typed.
  386.  
  387.  
  388.  
  389.  
  390.  
  391.  
  392.  
  393.  
  394.  
  395.  
  396.  
  397.  
  398.  
  399.  
  400.  
  401.  
  402.  
  403.  
  404.  
  405.  
  406.  
  407.  
  408.  
  409.  
  410.  
  411.  
  412.  
  413.  
  414.  
  415.  
  416.  
  417.  
  418.  
  419.  
  420.  
  421.  
  422.  
  423.  
  424.  
  425.         XLISP                 BREAK COMMAND LOOP                  Page 7
  426.  
  427.  
  428.         BREAK COMMAND LOOP
  429.  
  430.         When XLISP encounters an error while evaluating an expression,
  431.         it attempts to handle the error in the following way:
  432.  
  433.         If the symbol '*breakenable*' is true, the message corresponding
  434.         to the error is printed.  If the error is correctable, the
  435.         correction message is printed.  If the symbol '*tracenable*' is
  436.         true, a trace back is printed.  The number of entries printed
  437.         depends on the value of the symbol '*tracelimit*'.  If this
  438.         symbol is set to something other than a number, the entire trace
  439.         back stack is printed.  XLISP then enters a read/eval/print loop
  440.         to allow the user to examine the state of the interpreter in the
  441.         context of the error.  This loop differs from the normal top-
  442.         level read/eval/print loop in that if the user invokes the
  443.         function 'continue', XLISP will continue from a correctable
  444.         error.  If the user invokes the function 'clean-up', XLISP will
  445.         abort the break loop and return to the top level or the next
  446.         lower numbered break loop.  When in a break loop, XLISP prefixes
  447.         the break level to the normal prompt.
  448.  
  449.         If the symbol '*breakenable*' is nil, XLISP looks for a
  450.         surrounding errset function.  If one is found, XLISP examines
  451.         the value of the print flag.  If this flag is true, the error
  452.         message is printed.  In any case, XLISP causes the errset
  453.         function call to return nil.
  454.  
  455.         If there is no surrounding errset function, XLISP prints the
  456.         error message and returns to the top level.
  457.  
  458.  
  459.  
  460.  
  461.  
  462.  
  463.  
  464.  
  465.  
  466.  
  467.  
  468.  
  469.  
  470.  
  471.  
  472.  
  473.  
  474.  
  475.  
  476.  
  477.  
  478.  
  479.  
  480.  
  481.  
  482.  
  483.  
  484.  
  485.  
  486.  
  487.  
  488.  
  489.  
  490.  
  491.         XLISP                      DATA TYPES                     Page 8
  492.  
  493.  
  494.         DATA TYPES
  495.  
  496.         There are several different data types available to XLISP
  497.         programmers.
  498.  
  499.             o lists
  500.             o symbols
  501.             o strings
  502.             o integers
  503.             o floats
  504.             o objects
  505.             o arrays
  506.             o file pointers
  507.             o subrs (built-in functions)
  508.             o fsubrs (special forms)
  509.  
  510.         Another data type is the stream.  A stream is a list node whose
  511.         car points to the head of a list of integers and whose cdr
  512.         points to the last list node of the list.  An empty stream is a
  513.         list node whose car and cdr are nil.  Each of the integers in
  514.         the list represents a character in the stream.  When a character
  515.         is read from a stream, the first integer from the head of the
  516.         list is removed and returned.  When a character is written to a
  517.         stream, the integer representing the character code of the
  518.         character is appended to the end of the list.  When a function
  519.         indicates that it takes an input source as a parameter, this
  520.         parameter can either be an input file pointer or a stream.
  521.         Similarly, when a function indicates that it takes an output
  522.         sink as a parameter, this parameter can either be an output file
  523.         pointer or a stream.
  524.  
  525.  
  526.  
  527.  
  528.  
  529.  
  530.  
  531.  
  532.  
  533.  
  534.  
  535.  
  536.  
  537.  
  538.  
  539.  
  540.  
  541.  
  542.  
  543.  
  544.  
  545.  
  546.  
  547.  
  548.  
  549.  
  550.  
  551.  
  552.  
  553.  
  554.  
  555.  
  556.  
  557.         XLISP                    THE EVALUATOR                    Page 9
  558.  
  559.  
  560.         THE EVALUATOR
  561.  
  562.         The process of evaluation in XLISP:
  563.  
  564.         Integers, floats, strings, file pointers, subrs, fsubrs, objects
  565.         and arrays evaluate to themselves
  566.  
  567.         Symbols evaluate to the value associated with their current
  568.         binding
  569.  
  570.         Lists are evaluated by evaluating the first element of the list
  571.         and then taking one of the following actions:
  572.  
  573.             If it is a subr, the remaining list elements are evaluated
  574.             and the subr is called with these evaluated expressions as
  575.             arguments.
  576.  
  577.             If it is an fsubr, the fsubr is called using the remaining
  578.             list elements as arguments (unevaluated)
  579.  
  580.             If it is a list:
  581.  
  582.                 If the list is a function closure (a list whose car is a
  583.                 lambda expression and whose cdr is an environment list),
  584.                 the car of the list is used as the function to be
  585.                 applied and the cdr is used as the environment to be
  586.                 extended with the parameter bindings.
  587.  
  588.                 If the list is a lambda expression, the current
  589.                 environment is used for the function application.
  590.  
  591.                     In either of the above two cases, the remaining list
  592.                     elements are evaluated and the resulting expressions
  593.                     are bound to the formal arguments of the lambda
  594.                     expression.  The body of the function is executed
  595.                     within this new binding environment.
  596.  
  597.                 If it is a list and the car of the list is 'macro', the
  598.                 remaining list elements are bound to the formal
  599.                 arguments of the macro expression.  The body of the
  600.                 function is executed within this new binding
  601.                 environment.  The result of this evaluation is
  602.                 considered the macro expansion.  This result is then
  603.                 evaluated in place of the original expression.
  604.  
  605.                 If it is an object, the second list element is evaluated
  606.                 and used as a message selector.  The message formed by
  607.                 combining the selector with the values of the remaining
  608.                 list elements is sent to the object.
  609.  
  610.  
  611.  
  612.  
  613.  
  614.  
  615.  
  616.  
  617.  
  618.  
  619.  
  620.  
  621.  
  622.  
  623.         XLISP                 LEXICAL CONVENTIONS                Page 10
  624.  
  625.  
  626.         LEXICAL CONVENTIONS
  627.  
  628.         The following conventions must be followed when entering XLISP
  629.         programs:
  630.  
  631.         Comments in XLISP code begin with a semi-colon character and
  632.         continue to the end of the line.
  633.  
  634.         Symbol names in XLISP can consist of any sequence of non-blank
  635.         printable characters except the following:
  636.  
  637.                 ( ) ' ` , " ;
  638.  
  639.         Uppercase and lowercase characters are not distinguished within
  640.         symbol names.  All lowercase characters are mapped to uppercase
  641.         on input.
  642.  
  643.         Integer literals consist of a sequence of digits optionally
  644.         beginning with a '+' or '-'.  The range of values an integer can
  645.         represent is limited by the size of a C 'long' on the machine on
  646.         which XLISP is running.
  647.  
  648.         Floating point literals consist of a sequence of digits
  649.         optionally beginning with a '+' or '-' and including an embedded
  650.         decimal point.  The range of values a floating point number can
  651.         represent is limited by the size of a C 'float' ('double' on
  652.         machines with 32 bit addresses) on the machine on which XLISP is
  653.         running.
  654.  
  655.         Literal strings are sequences of characters surrounded by double
  656.         quotes.  Within quoted strings the '' character is used to allow
  657.         non-printable characters to be included.  The codes recognized
  658.         are:
  659.  
  660.                 \\        means the character '\'
  661.                 \n       means newline
  662.                 \t       means tab
  663.                 \r       means return
  664.                 \f       means form feed
  665.                 \nnn     means the character whose octal code is nnn
  666.  
  667.         XLISP defines several useful read macros:
  668.  
  669.                 '<expr>         == (quote <expr>)
  670.                 #'<expr>        == (function <expr>)
  671.                 #(<expr>...)    == an array of the specified expressions
  672.                 #x<hdigits>     == a hexadecimal number
  673.                 #\<char> == the ASCII code of the character
  674.                 `<expr>         == (backquote <expr>)
  675.                 ,<expr>         == (comma <expr>)
  676.                 ,@<expr>        == (comma-at <expr>)
  677.  
  678.  
  679.  
  680.  
  681.  
  682.  
  683.  
  684.  
  685.  
  686.  
  687.  
  688.  
  689.         XLISP                      READTABLES                    Page 11
  690.  
  691.  
  692.         READTABLES
  693.  
  694.         The behaviour of the reader is controlled by a data structure
  695.         called a "readtable".  The reader uses the symbol *READTABLE* to
  696.         locate the current readtable.  This table controls the
  697.         interpretation of input characters.  It is an array with 128
  698.         entries, one for each of the ASCII character codes.  Each entry
  699.         contains one of the following things:
  700.  
  701.                 NIL             Indicating an invalid character
  702.                 :CONSTITUENT    Indicating a symbol constituent
  703.                 :WHITE-SPACE    Indicating a whitespace character
  704.                 (:TMACRO . fun) Terminating readmacro
  705.                 (:NMACRO . fun) Non-terminating readmacro
  706.  
  707.         In the case of the last two forms, the "fun" component is a
  708.         function definition.  This can either be a pointer to a built-in
  709.         readmacro function or a lambda expression.  The function should
  710.         take two parameters.  The first is the input stream and the
  711.         second is the character that caused the invocation of the
  712.         readmacro.  The character is passed as an integer.  The
  713.         readmacro function should return NIL to indicate that the
  714.         character should be treated as white space or a value consed
  715.         with NIL to indicate that the readmacro should be treated as an
  716.         occurance of the specified value.  Of course, the readmacro code
  717.         is free to read additional characters from the input stream.
  718.  
  719.  
  720.  
  721.  
  722.  
  723.  
  724.  
  725.  
  726.  
  727.  
  728.  
  729.  
  730.  
  731.  
  732.  
  733.  
  734.  
  735.  
  736.  
  737.  
  738.  
  739.  
  740.  
  741.  
  742.  
  743.  
  744.  
  745.  
  746.  
  747.  
  748.  
  749.  
  750.  
  751.  
  752.  
  753.  
  754.  
  755.         XLISP                       OBJECTS                      Page 12
  756.  
  757.  
  758.         OBJECTS
  759.  
  760.         Definitions:
  761.  
  762.             o selector - a symbol used to select an appropriate method
  763.             o message - a selector and a list of actual arguments
  764.             o method - the code that implements a message
  765.  
  766.         Since XLISP was created to provide a simple basis for
  767.         experimenting with object-oriented programming, one of the
  768.         primitive data types included is 'object'.  In XLISP, an object
  769.         consists of a data structure containing a pointer to the
  770.         object's class as well as an array containing the values of the
  771.         object's instance variables.
  772.  
  773.         Officially, there is no way to see inside an object (look at the
  774.         values of its instance variables).  The only way to communicate
  775.         with an object is by sending it a message.  When the XLISP
  776.         evaluator evaluates a list the value of whose first element is
  777.         an object, it interprets the value of the second element of the
  778.         list (which must be a symbol) as the message selector.  The
  779.         evaluator determines the class of the receiving object and
  780.         attempts to find a method corresponding to the message selector
  781.         in the set of messages defined for that class.  If the message
  782.         is not found in the object's class and the class has a super-
  783.         class, the search continues by looking at the messages defined
  784.         for the super-class.  This process continues from one super-
  785.         class to the next until a method for the message is found.  If
  786.         no method is found, an error occurs.
  787.  
  788.         When a method is found, the evaluator binds the receiving object
  789.         to the symbol 'self', binds the class in which the method was
  790.         found to the symbol 'msgclass', and evaluates the method using
  791.         the remaining elements of the original list as arguments to the
  792.         method.  These arguments are always evaluated prior to being
  793.         bound to their corresponding formal arguments.  The result of
  794.         evaluating the method becomes the result of the expression.
  795.  
  796.  
  797.  
  798.  
  799.  
  800.  
  801.  
  802.  
  803.  
  804.  
  805.  
  806.  
  807.  
  808.  
  809.  
  810.  
  811.  
  812.  
  813.  
  814.  
  815.  
  816.  
  817.  
  818.  
  819.  
  820.  
  821.         XLISP                       OBJECTS                      Page 13
  822.  
  823.  
  824.         THE 'Object' CLASS
  825.  
  826.         Classes:
  827.  
  828.         Object  THE TOP OF THE CLASS HEIRARCHY
  829.  
  830.             Messages:
  831.  
  832.                 :show  SHOW AN OBJECT'S INSTANCE VARIABLES
  833.                     returns     the object
  834.  
  835.                 :class  RETURN THE CLASS OF AN OBJECT
  836.                     returns     the class of the object
  837.  
  838.                 :isnew  THE DEFAULT OBJECT INITIALIZATION ROUTINE
  839.                     returns     the object
  840.  
  841.                 :sendsuper <sel> [<args>]...  SEND SUPERCLASS A MESSAGE
  842.                     <sel>       the message selector
  843.                     <args>      the message arguments
  844.                     returns     the result of sending the message
  845.  
  846.  
  847.  
  848.  
  849.  
  850.  
  851.  
  852.  
  853.  
  854.  
  855.  
  856.  
  857.  
  858.  
  859.  
  860.  
  861.  
  862.  
  863.  
  864.  
  865.  
  866.  
  867.  
  868.  
  869.  
  870.  
  871.  
  872.  
  873.  
  874.  
  875.  
  876.  
  877.  
  878.  
  879.  
  880.  
  881.  
  882.  
  883.  
  884.  
  885.  
  886.  
  887.         XLISP                       OBJECTS                      Page 14
  888.  
  889.  
  890.         THE 'Class' CLASS
  891.  
  892.         Class   THE CLASS OF ALL OBJECT CLASSES (including itself)
  893.  
  894.             Messages:
  895.  
  896.                 :new  CREATE A NEW INSTANCE OF A CLASS
  897.                     returns     the new class object
  898.  
  899.                 :isnew <ivars> [<cvars>[<super>]]  INITIALIZE A NEW CLASS
  900.                     <ivars>     the list of instance variable symbols
  901.                     <cvars>     the list of class variable symbols
  902.                     <super>     the superclass (default is Object)
  903.                     returns     the new class object
  904.  
  905.                 :answer <msg> <fargs> <code>  ADD A MESSAGE TO A CLASS
  906.                     <msg>       the message symbol
  907.                     <fargs>     the formal argument list
  908.                                   this list is of the form:
  909.                                     ([<farg>]...
  910.                                      [&optional [<oarg>]...]
  911.                                      [&rest <rarg>]
  912.                                      [&aux [<aux>]...])
  913.                                   where
  914.                                     <farg>   a formal argument
  915.                                     <oarg>   an optional argument
  916.                                     <rarg>   bound to rest of the arguments
  917.                                     <aux>    a auxiliary variable
  918.                     <code>      a list of executable expressions
  919.                     returns     the object
  920.  
  921.  
  922.         When a new instance of a class is created by sending the message
  923.         ':new' to an existing class, the message ':isnew' followed by
  924.         whatever parameters were passed to the ':new' message is sent to
  925.         the newly created object.
  926.  
  927.         When a new class is created by sending the ':new' message to the
  928.         object 'Class', an optional parameter may be specified
  929.         indicating the superclass of the new class.  If this parameter
  930.         is omitted, the new class will be a subclass of 'Object'.  A
  931.         class inherits all instance variables, class variables, and
  932.         methods from its super-class.
  933.  
  934.  
  935.  
  936.  
  937.  
  938.  
  939.  
  940.  
  941.  
  942.  
  943.  
  944.  
  945.  
  946.  
  947.  
  948.  
  949.  
  950.  
  951.  
  952.  
  953.         XLISP                       SYMBOLS                      Page 15
  954.  
  955.  
  956.         SYMBOLS
  957.  
  958.             o self - the current object (within a message context)
  959.             o msgclass - the class in which the current method was found
  960.             o *obarray* - the object hash table
  961.             o *standard-input* - the standard input file
  962.             o *standard-output* - the standard output file
  963.             o *breakenable* - flag controlling entering break loop on errors
  964.             o *tracenable* - enable baktrace on errors
  965.             o *tracelimit* - number of levels of trace back information
  966.             o *evalhook* - user substitute for the evaluator function
  967.             o *applyhook* - (not yet implemented)
  968.             o *readtable* - the current readtable
  969.             o *unbound* - indicator for unbound symbols
  970.  
  971.  
  972.  
  973.  
  974.  
  975.  
  976.  
  977.  
  978.  
  979.  
  980.  
  981.  
  982.  
  983.  
  984.  
  985.  
  986.  
  987.  
  988.  
  989.  
  990.  
  991.  
  992.  
  993.  
  994.  
  995.  
  996.  
  997.  
  998.  
  999.  
  1000.  
  1001.  
  1002.  
  1003.  
  1004.  
  1005.  
  1006.  
  1007.  
  1008.  
  1009.  
  1010.  
  1011.  
  1012.  
  1013.  
  1014.  
  1015.  
  1016.  
  1017.  
  1018.  
  1019.         XLISP                 EVALUATION FUNCTIONS               Page 16
  1020.  
  1021.  
  1022.         EVALUATION FUNCTIONS
  1023.  
  1024.         (eval <expr>)  EVALUATE AN XLISP EXPRESSION
  1025.             <expr>      the expression to be evaluated
  1026.             returns     the result of evaluating the expression
  1027.  
  1028.         (apply <fun> <args>)  APPLY A FUNCTION TO A LIST OF ARGUMENTS
  1029.             <fun>       the function to apply (or function symbol)
  1030.             <args>      the argument list
  1031.             returns     the result of applying the function to the arguments
  1032.  
  1033.         (funcall <fun> [<arg>]...)  CALL A FUNCTION WITH ARGUMENTS
  1034.             <fun>       the function to call (or function symbol)
  1035.             <arg>       arguments to pass to the function
  1036.             returns     the result of calling the function with the arguments
  1037.  
  1038.         (quote <expr>)  RETURN AN EXPRESSION UNEVALUATED
  1039.             <expr>      the expression to be quoted (quoted)
  1040.             returns     <expr> unevaluated
  1041.  
  1042.         (function <expr>)  QUOTE A FUNCTION
  1043.             <expr>      the function to be quoted (quoted)
  1044.             returns     a function closure
  1045.  
  1046.         (backquote <expr>)  FILL IN A TEMPLATE
  1047.             <expr>      the template
  1048.             returns     a copy of the template with comma and comma-at
  1049.                         expressions expanded
  1050.  
  1051.         (lambda <args> [<expr>]...)  MAKE A FUNCTION CLOSURE
  1052.             <args>      the argument list (quoted)
  1053.             <expr>      expressions of the function body
  1054.             returns     the function closure
  1055.  
  1056.  
  1057.  
  1058.  
  1059.  
  1060.  
  1061.  
  1062.  
  1063.  
  1064.  
  1065.  
  1066.  
  1067.  
  1068.  
  1069.  
  1070.  
  1071.  
  1072.  
  1073.  
  1074.  
  1075.  
  1076.  
  1077.  
  1078.  
  1079.  
  1080.  
  1081.  
  1082.  
  1083.  
  1084.  
  1085.         XLISP                   SYMBOL FUNCTIONS                 Page 17
  1086.  
  1087.  
  1088.         SYMBOL FUNCTIONS
  1089.  
  1090.         (set <sym> <expr>)  SET THE VALUE OF A SYMBOL
  1091.             <sym>       the symbol being set
  1092.             <expr>      the new value
  1093.             returns     the new value
  1094.  
  1095.         (setq [<sym> <expr>]...)  SET THE VALUE OF A SYMBOL
  1096.             <sym>       the symbol being set (quoted)
  1097.             <expr>      the new value
  1098.             returns     the new value
  1099.  
  1100.         (setf [<place> <expr>]...)  SET THE VALUE OF A FIELD
  1101.             <place>     the field specifier (quoted):
  1102.                             <sym>                set value of a symbol
  1103.                             (car <expr>)         set car of a list node
  1104.                             (cdr <expr>)         set cdr of a list node
  1105.                             (nth <n> <expr>)     set nth car of a list
  1106.                             (aref <expr> <n>)    set nth element of an array
  1107.                             (get <sym> <prop>)   set value of a property
  1108.                             (symbol-value <sym>) set value of a symbol
  1109.                             (symbol-plist <sym>) set property list of a symbol
  1110.             <value>     the new value
  1111.             returns     the new value
  1112.  
  1113.         (defun <sym> <fargs> [<expr>]...)  DEFINE A FUNCTION
  1114.         (defmacro <sym> <fargs> [<expr>]...)  DEFINE A MACRO
  1115.             <sym>       symbol being defined (quoted)
  1116.             <fargs>     list of formal arguments (quoted)
  1117.                           this list is of the form:
  1118.                             ([<farg>]...
  1119.                              [&optional [<oarg>]...]
  1120.                              [&rest <rarg>]
  1121.                              [&aux [<aux>]...])
  1122.                           where
  1123.                             <farg>      is a formal argument
  1124.                             <oarg>      is an optional argument
  1125.                             <rarg>      bound to the rest of the arguments
  1126.                             <aux>       is an auxiliary variable
  1127.             <expr>      expressions constituting the body of the
  1128.                         function (quoted)
  1129.             returns     the function symbol
  1130.  
  1131.         (gensym [<tag>])  GENERATE A SYMBOL
  1132.             <tag>       string or number
  1133.             returns     the new symbol
  1134.  
  1135.         (intern <pname>)  MAKE AN INTERNED SYMBOL
  1136.             <pname>     the symbol's print name string
  1137.             returns     the new symbol
  1138.  
  1139.         (make-symbol <pname>)  MAKE AN UNINTERNED SYMBOL
  1140.             <pname>     the symbol's print name string
  1141.             returns     the new symbol
  1142.  
  1143.  
  1144.  
  1145.  
  1146.  
  1147.  
  1148.  
  1149.  
  1150.  
  1151.         XLISP                   SYMBOL FUNCTIONS                 Page 18
  1152.  
  1153.  
  1154.         (symbol-name <sym>)  GET THE PRINT NAME OF A SYMBOL
  1155.             <sym>       the symbol
  1156.             returns     the symbol's print name
  1157.  
  1158.         (symbol-value <sym>)  GET THE VALUE OF A SYMBOL
  1159.             <sym>       the symbol
  1160.             returns     the symbol's value
  1161.  
  1162.         (symbol-plist <sym>)  GET THE PROPERTY LIST OF A SYMBOL
  1163.             <sym>       the symbol
  1164.             returns     the symbol's property list
  1165.  
  1166.         (hash <sym> <n>)  COMPUTE THE HASH INDEX FOR A SYMBOL
  1167.             <sym>       the symbol or string
  1168.             <n>         the table size (integer)
  1169.             returns     the hash index (integer)
  1170.  
  1171.  
  1172.  
  1173.  
  1174.  
  1175.  
  1176.  
  1177.  
  1178.  
  1179.  
  1180.  
  1181.  
  1182.  
  1183.  
  1184.  
  1185.  
  1186.  
  1187.  
  1188.  
  1189.  
  1190.  
  1191.  
  1192.  
  1193.  
  1194.  
  1195.  
  1196.  
  1197.  
  1198.  
  1199.  
  1200.  
  1201.  
  1202.  
  1203.  
  1204.  
  1205.  
  1206.  
  1207.  
  1208.  
  1209.  
  1210.  
  1211.  
  1212.  
  1213.  
  1214.  
  1215.  
  1216.  
  1217.         XLISP               PROPERTY LIST FUNCTIONS              Page 19
  1218.  
  1219.  
  1220.         PROPERTY LIST FUNCTIONS
  1221.  
  1222.         (get <sym> <prop>)  GET THE VALUE OF A PROPERTY
  1223.             <sym>       the symbol
  1224.             <prop>      the property symbol
  1225.             returns     the property value or nil
  1226.  
  1227.         (putprop <sym> <val> <prop>)  PUT A PROPERTY ONTO A PROPERTY LIST
  1228.             <sym>       the symbol
  1229.             <val>       the property value
  1230.             <prop>      the property symbol
  1231.             returns     the property value
  1232.  
  1233.         (remprop <sym> <prop>)  REMOVE A PROPERTY
  1234.             <sym>       the symbol
  1235.             <prop>      the property symbol
  1236.             returns     nil
  1237.  
  1238.  
  1239.  
  1240.  
  1241.  
  1242.  
  1243.  
  1244.  
  1245.  
  1246.  
  1247.  
  1248.  
  1249.  
  1250.  
  1251.  
  1252.  
  1253.  
  1254.  
  1255.  
  1256.  
  1257.  
  1258.  
  1259.  
  1260.  
  1261.  
  1262.  
  1263.  
  1264.  
  1265.  
  1266.  
  1267.  
  1268.  
  1269.  
  1270.  
  1271.  
  1272.  
  1273.  
  1274.  
  1275.  
  1276.  
  1277.  
  1278.  
  1279.  
  1280.  
  1281.  
  1282.  
  1283.         XLISP                   ARRAY FUNCTIONS                  Page 20
  1284.  
  1285.  
  1286.         ARRAY FUNCTIONS
  1287.  
  1288.         (aref <array> <n>)  GET THE NTH ELEMENT OF AN ARRAY
  1289.             <array>     the array
  1290.             <n>         the array index (integer)
  1291.             returns     the value of the array element
  1292.  
  1293.         (make-array <size>)  MAKE A NEW ARRAY
  1294.             <size>      the size of the new array (integer)
  1295.             returns     the new array
  1296.  
  1297.  
  1298.  
  1299.  
  1300.  
  1301.  
  1302.  
  1303.  
  1304.  
  1305.  
  1306.  
  1307.  
  1308.  
  1309.  
  1310.  
  1311.  
  1312.  
  1313.  
  1314.  
  1315.  
  1316.  
  1317.  
  1318.  
  1319.  
  1320.  
  1321.  
  1322.  
  1323.  
  1324.  
  1325.  
  1326.  
  1327.  
  1328.  
  1329.  
  1330.  
  1331.  
  1332.  
  1333.  
  1334.  
  1335.  
  1336.  
  1337.  
  1338.  
  1339.  
  1340.  
  1341.  
  1342.  
  1343.  
  1344.  
  1345.  
  1346.  
  1347.  
  1348.  
  1349.         XLISP                    LIST FUNCTIONS                  Page 21
  1350.  
  1351.  
  1352.         LIST FUNCTIONS
  1353.  
  1354.         (car <expr>)  RETURN THE CAR OF A LIST NODE
  1355.             <expr>      the list node
  1356.             returns     the car of the list node
  1357.  
  1358.         (cdr <expr>)  RETURN THE CDR OF A LIST NODE
  1359.             <expr>      the list node
  1360.             returns     the cdr of the list node
  1361.  
  1362.         (cxxr <expr>)  ALL CxxR COMBINATIONS
  1363.         (cxxxr <expr>)  ALL CxxxR COMBINATIONS
  1364.         (cxxxxr <expr>)  ALL CxxxxR COMBINATIONS
  1365.  
  1366.         (cons <expr1> <expr2>)  CONSTRUCT A NEW LIST NODE
  1367.             <expr1>     the car of the new list node
  1368.             <expr2>     the cdr of the new list node
  1369.             returns     the new list node
  1370.  
  1371.         (list [<expr>]...)  CREATE A LIST OF VALUES
  1372.             <expr>      expressions to be combined into a list
  1373.             returns     the new list
  1374.  
  1375.         (append [<expr>]...)  APPEND LISTS
  1376.             <expr>      lists whose elements are to be appended
  1377.             returns     the new list
  1378.  
  1379.         (reverse <expr>)  REVERSE A LIST
  1380.             <expr>      the list to reverse
  1381.             returns     a new list in the reverse order
  1382.  
  1383.         (last <list>)  RETURN THE LAST LIST NODE OF A LIST
  1384.             <list>      the list
  1385.             returns     the last list node in the list
  1386.  
  1387.         (member <expr> <list> [<key> <test>])  FIND AN EXPRESSION IN A LIST
  1388.             <expr>      the expression to find
  1389.             <list>      the list to search
  1390.             <key>       the keyword :test or :test-not
  1391.             <test>      the test function (defaults to eql)
  1392.             returns     the remainder of the list starting with the expression
  1393.  
  1394.         (assoc <expr> <alist> [<key> <test>])  FIND AN EXPRESSION IN AN A-LIST
  1395.             <expr>      the expression to find
  1396.             <alist>     the association list
  1397.             <key>       the keyword :test or :test-not
  1398.             <test>      the test function (defaults to eql)
  1399.             returns     the alist entry or nil
  1400.  
  1401.  
  1402.  
  1403.  
  1404.  
  1405.  
  1406.  
  1407.  
  1408.  
  1409.  
  1410.  
  1411.  
  1412.  
  1413.  
  1414.  
  1415.         XLISP                    LIST FUNCTIONS                  Page 22
  1416.  
  1417.  
  1418.         (remove <expr> <list> [<key> <test>])  REMOVE AN EXPRESSION
  1419.             <expr>      the expression to delete
  1420.             <list>      the list
  1421.             <key>       the keyword :test or :test-not
  1422.             <test>      the test function (defaults to eql)
  1423.             returns     the list with the matching expressions deleted
  1424.  
  1425.         (length <expr>)  FIND THE LENGTH OF A LIST OR STRING
  1426.             <expr>      the list or string
  1427.             returns     the length of the list or string
  1428.  
  1429.         (nth <n> <list>)  RETURN THE NTH ELEMENT OF A LIST
  1430.             <n>         the number of the element to return (zero origin)
  1431.             <list>      the list
  1432.             returns     the nth element or nil if the list isn't that long
  1433.  
  1434.         (nthcdr <n> <list>)  RETURN THE NTH CDR OF A LIST
  1435.             <n>         the number of the element to return (zero origin)
  1436.             <list>      the list
  1437.             returns     the nth cdr or nil if the list isn't that long
  1438.  
  1439.         (mapc <fcn> <list1> [<list>]...)  APPLY FUNCTION TO SUCCESSIVE CARS
  1440.             <fcn>       the function or function name
  1441.             <listn>     a list for each argument of the function
  1442.             returns     the first list of arguments
  1443.  
  1444.         (mapcar <fcn> <list1> [<list>]...)  APPLY FUNCTION TO SUCCESSIVE CARS
  1445.             <fcn>       the function or function name
  1446.             <listn>     a list for each argument of the function
  1447.             returns     a list of the values returned
  1448.  
  1449.         (mapl <fcn> <list1> [<list>]...)  APPLY FUNCTION TO SUCCESSIVE CDRS
  1450.             <fcn>       the function or function name
  1451.             <listn>     a list for each argument of the function
  1452.             returns     the first list of arguments
  1453.  
  1454.         (maplist <fcn> <list1> [<list>]...)  APPLY FUNCTION TO SUCCESSIVE CDRS
  1455.             <fcn>       the function or function name
  1456.             <listn>     a list for each argument of the function
  1457.             returns     a list of the values returned
  1458.  
  1459.  
  1460.  
  1461.  
  1462.  
  1463.  
  1464.  
  1465.  
  1466.  
  1467.  
  1468.  
  1469.  
  1470.  
  1471.  
  1472.  
  1473.  
  1474.  
  1475.  
  1476.  
  1477.  
  1478.  
  1479.  
  1480.  
  1481.         XLISP                    LIST FUNCTIONS                  Page 23
  1482.  
  1483.  
  1484.         (subst <to> <from> <expr> [<key> <test>])  SUBSTITUTE EXPRESSIONS
  1485.             <to>        the new expression
  1486.             <from>      the old expression
  1487.             <expr>      the expression in which to do the substitutions
  1488.             <key>       the keyword :test or :test-not
  1489.             <test>      the test function (defaults to eql)
  1490.             returns     the expression with substitutions
  1491.  
  1492.         (sublis <alist> <expr> [<key> <test>])  SUBSTITUTE WITH AN A-LIST
  1493.             <alist>     the association list
  1494.             <expr>      the expression in which to do the substitutions
  1495.             <key>       the keyword :test or :test-not
  1496.             <test>      the test function (defaults to eql)
  1497.             returns     the expression with substitutions
  1498.  
  1499.  
  1500.  
  1501.  
  1502.  
  1503.  
  1504.  
  1505.  
  1506.  
  1507.  
  1508.  
  1509.  
  1510.  
  1511.  
  1512.  
  1513.  
  1514.  
  1515.  
  1516.  
  1517.  
  1518.  
  1519.  
  1520.  
  1521.  
  1522.  
  1523.  
  1524.  
  1525.  
  1526.  
  1527.  
  1528.  
  1529.  
  1530.  
  1531.  
  1532.  
  1533.  
  1534.  
  1535.  
  1536.  
  1537.  
  1538.  
  1539.  
  1540.  
  1541.  
  1542.  
  1543.  
  1544.  
  1545.  
  1546.  
  1547.         XLISP              DESTRUCTIVE LIST FUNCTIONS            Page 24
  1548.  
  1549.  
  1550.         DESTRUCTIVE LIST FUNCTIONS
  1551.  
  1552.         (rplaca <list> <expr>)  REPLACE THE CAR OF A LIST NODE
  1553.             <list>      the list node
  1554.             <expr>      the new value for the car of the list node
  1555.             returns     the list node after updating the car
  1556.  
  1557.         (rplacd <list> <expr>)  REPLACE THE CDR OF A LIST NODE
  1558.             <list>      the list node
  1559.             <expr>      the new value for the cdr of the list node
  1560.             returns     the list node after updating the cdr
  1561.  
  1562.         (nconc [<list>]...)  DESTRUCTIVELY CONCATENATE LISTS
  1563.             <list>      lists to concatenate
  1564.             returns     the result of concatenating the lists
  1565.  
  1566.         (delete <expr> <list> [<key> <test>])  DELETE AN EXPRESSION FROM A LIST
  1567.             <expr>      the expression to delete
  1568.             <list>      the list
  1569.             <key>       the keyword :test or :test-not
  1570.             <test>      the test function (defaults to eql)
  1571.             returns     the list with the matching expressions deleted
  1572.  
  1573.  
  1574.  
  1575.  
  1576.  
  1577.  
  1578.  
  1579.  
  1580.  
  1581.  
  1582.  
  1583.  
  1584.  
  1585.  
  1586.  
  1587.  
  1588.  
  1589.  
  1590.  
  1591.  
  1592.  
  1593.  
  1594.  
  1595.  
  1596.  
  1597.  
  1598.  
  1599.  
  1600.  
  1601.  
  1602.  
  1603.  
  1604.  
  1605.  
  1606.  
  1607.  
  1608.  
  1609.  
  1610.  
  1611.  
  1612.  
  1613.         XLISP                 PREDICATE FUNCTIONS                Page 25
  1614.  
  1615.  
  1616.         PREDICATE FUNCTIONS
  1617.  
  1618.         (atom <expr>)  IS THIS AN ATOM?
  1619.             <expr>      the expression to check
  1620.             returns     t if the value is an atom, nil otherwise
  1621.  
  1622.         (symbolp <expr>)  IS THIS A SYMBOL?
  1623.             <expr>      the expression to check
  1624.             returns     t if the expression is a symbol, nil otherwise
  1625.  
  1626.         (numberp <expr>)  IS THIS A NUMBER?
  1627.             <expr>      the expression to check
  1628.             returns     t if the expression is a number, nil otherwise
  1629.  
  1630.         (null <expr>)  IS THIS AN EMPTY LIST?
  1631.             <expr>      the list to check
  1632.             returns     t if the list is empty, nil otherwise
  1633.  
  1634.         (not <expr>)  IS THIS FALSE?
  1635.             <expr>      the expression to check
  1636.             return      t if the expression is nil, nil otherwise
  1637.  
  1638.         (listp <expr>)  IS THIS A LIST?
  1639.             <expr>      the expression to check
  1640.             returns     t if the value is a list node or nil, nil otherwise
  1641.  
  1642.         (consp <expr>)  IS THIS A NON-EMPTY LIST?
  1643.             <expr>      the expression to check
  1644.             returns     t if the value is a list node, nil otherwise
  1645.  
  1646.         (boundp <sym>)  IS THIS A BOUND SYMBOL?
  1647.             <sym>       the symbol
  1648.             returns     t if a value is bound to the symbol, nil otherwise
  1649.  
  1650.  
  1651.  
  1652.  
  1653.  
  1654.  
  1655.  
  1656.  
  1657.  
  1658.  
  1659.  
  1660.  
  1661.  
  1662.  
  1663.  
  1664.  
  1665.  
  1666.  
  1667.  
  1668.  
  1669.  
  1670.  
  1671.  
  1672.  
  1673.  
  1674.  
  1675.  
  1676.  
  1677.  
  1678.  
  1679.         XLISP                 PREDICATE FUNCTIONS                Page 26
  1680.  
  1681.  
  1682.         (minusp <expr>)  IS THIS NUMBER NEGATIVE?
  1683.             <expr>      the number to test
  1684.             returns     t if the number is negative, nil otherwise
  1685.  
  1686.         (zerop <expr>)  IS THIS NUMBER ZERO?
  1687.             <expr>      the number to test
  1688.             returns     t if the number is zero, nil otherwise
  1689.  
  1690.         (plusp <expr>)  IS THIS NUMBER POSITIVE?
  1691.             <expr>      the number to test
  1692.             returns     t if the number is positive, nil otherwise
  1693.  
  1694.         (evenp <expr>)  IS THIS NUMBER EVEN?
  1695.             <expr>      the number to test
  1696.             returns     t if the number is even, nil otherwise
  1697.  
  1698.         (oddp <expr>)  IS THIS NUMBER ODD?
  1699.             <expr>      the number to test
  1700.             returns     t if the number is odd, nil otherwise
  1701.  
  1702.         (eq <expr1> <expr2>)  ARE THE EXPRESSIONS IDENTICAL?
  1703.             <expr1>     the first expression
  1704.             <expr2>     the second expression
  1705.             returns     t if they are equal, nil otherwise
  1706.  
  1707.         (eql <expr1> <expr2>)  ARE THE EXPRESSIONS IDENTICAL?
  1708.                                 (WORKS WITH NUMBERS AND STRINGS)
  1709.             <expr1>     the first expression
  1710.             <expr2>     the second expression
  1711.             returns     t if they are equal, nil otherwise
  1712.  
  1713.         (equal <expr1> <expr2>)  ARE THE EXPRESSIONS EQUAL?
  1714.             <expr1>     the first expression
  1715.             <expr2>     the second expression
  1716.             returns     t if they are equal, nil otherwise
  1717.  
  1718.  
  1719.  
  1720.  
  1721.  
  1722.  
  1723.  
  1724.  
  1725.  
  1726.  
  1727.  
  1728.  
  1729.  
  1730.  
  1731.  
  1732.  
  1733.  
  1734.  
  1735.  
  1736.  
  1737.  
  1738.  
  1739.  
  1740.  
  1741.  
  1742.  
  1743.  
  1744.  
  1745.         XLISP                  CONTROL CONSTRUCTS                Page 27
  1746.  
  1747.  
  1748.         CONTROL CONSTRUCTS
  1749.  
  1750.         (cond [<pair>]...)  EVALUATE CONDITIONALLY
  1751.             <pair>      pair consisting of:
  1752.                             (<pred> [<expr>]...)
  1753.                           where
  1754.                             <pred>      is a predicate expression
  1755.                             <expr>      evaluated if the predicate
  1756.                                         is not nil
  1757.             returns     the value of the first expression whose predicate
  1758.                         is not nil
  1759.  
  1760.         (and [<expr>]...)  THE LOGICAL AND OF A LIST OF EXPRESSIONS
  1761.             <expr>      the expressions to be ANDed
  1762.             returns     nil if any expression evaluates to nil,
  1763.                         otherwise the value of the last expression
  1764.                         (evaluation of expressions stops after the first
  1765.                          expression that evaluates to nil)
  1766.  
  1767.         (or [<expr>]...)  THE LOGICAL OR OF A LIST OF EXPRESSIONS
  1768.             <expr>      the expressions to be ORed
  1769.             returns     nil if all expressions evaluate to nil,
  1770.                         otherwise the value of the first non-nil expression
  1771.                         (evaluation of expressions stops after the first
  1772.                          expression that does not evaluate to nil)
  1773.  
  1774.         (if <texpr> <expr1> [<expr2>])  EXECUTE EXPRESSIONS CONDITIONALLY
  1775.             <texpr>     the test expression
  1776.             <expr1>     the expression to be evaluated if texpr is non-nil
  1777.             <expr2>     the expression to be evaluated if texpr is nil
  1778.             returns     the value of the selected expression
  1779.  
  1780.         (case <expr> [<case>]...)  SELECT BY CASE
  1781.             <expr>      the selection expression
  1782.             <case>      pair consisting of:
  1783.                             (<value> [<expr>]...)
  1784.                           where:
  1785.                             <value>     is a single expression or a list of
  1786.                                         expressions (unevaluated)
  1787.                             <expr>      are expressions to execute if the
  1788.                                         case matches
  1789.             returns     the value of the last expression of the matching case
  1790.  
  1791.         (let ([<binding>]...) [<expr>]...)  CREATE LOCAL BINDINGS
  1792.         (let* ([<binding>]...) [<expr>]...)  LET WITH SEQUENTIAL BINDING
  1793.             <binding>   the variable bindings each of which is either:
  1794.                         1)  a symbol (which is initialized to nil)
  1795.                         2)  a list whose car is a symbol and whose cadr
  1796.                                 is an initialization expression
  1797.             <expr>      the expressions to be evaluated
  1798.             returns     the value of the last expression
  1799.  
  1800.         (catch <sym> [<expr>]...)  EVALUATE EXPRESSIONS AND CATCH THROWS
  1801.             <sym>       the catch tag
  1802.  
  1803.  
  1804.  
  1805.  
  1806.  
  1807.  
  1808.  
  1809.  
  1810.  
  1811.         XLISP                  CONTROL CONSTRUCTS                Page 28
  1812.  
  1813.  
  1814.             <expr>      expressions to evaluate
  1815.             returns     the value of the last expression the throw expression
  1816.  
  1817.         (throw <sym> [<expr>])  THROW TO A CATCH
  1818.             <sym>       the catch tag
  1819.             <expr>      the value for the catch to return (defaults to nil)
  1820.             returns     never returns
  1821.  
  1822.  
  1823.  
  1824.  
  1825.  
  1826.  
  1827.  
  1828.  
  1829.  
  1830.  
  1831.  
  1832.  
  1833.  
  1834.  
  1835.  
  1836.  
  1837.  
  1838.  
  1839.  
  1840.  
  1841.  
  1842.  
  1843.  
  1844.  
  1845.  
  1846.  
  1847.  
  1848.  
  1849.  
  1850.  
  1851.  
  1852.  
  1853.  
  1854.  
  1855.  
  1856.  
  1857.  
  1858.  
  1859.  
  1860.  
  1861.  
  1862.  
  1863.  
  1864.  
  1865.  
  1866.  
  1867.  
  1868.  
  1869.  
  1870.  
  1871.  
  1872.  
  1873.  
  1874.  
  1875.  
  1876.  
  1877.         XLISP                  LOOPING CONSTRUCTS                Page 29
  1878.  
  1879.  
  1880.         LOOPING CONSTRUCTS
  1881.  
  1882.         (do ([<binding>]...) (<texpr> [<rexpr>]...) [<expr>]...)
  1883.         (do* ([<binding>]...) (<texpr> [<rexpr>]...) [<expr>]...)
  1884.             <binding>   the variable bindings each of which is either:
  1885.                         1)  a symbol (which is initialized to nil)
  1886.                         2)  a list of the form: (<sym> <init> [<step>])
  1887.                             where:
  1888.                                 <sym>  is the symbol to bind
  1889.                                 <init> is the initial value of the symbol
  1890.                                 <step> is a step expression
  1891.             <texpr>     the termination test expression
  1892.             <rexpr>     result expressions (the default is nil)
  1893.             <expr>      the body of the loop (treated like an implicit prog)
  1894.             returns     the value of the last result expression
  1895.  
  1896.         (dolist (<sym> <expr> [<rexpr>]) [<expr>]...)  LOOP THROUGH A LIST
  1897.             <sym>       the symbol to bind to each list element
  1898.             <expr>      the list expression
  1899.             <rexpr>     the result expression (the default is nil)
  1900.             <expr>      the body of the loop (treated like an implicit prog)
  1901.  
  1902.         (dotimes (<sym> <expr> [<rexpr>]) [<expr>]...)  LOOP FROM ZERO TO N-1
  1903.             <sym>       the symbol to bind to each value from 0 to n-1
  1904.             <expr>      the number of times to loop
  1905.             <rexpr>     the result expression (the default is nil)
  1906.             <expr>      the body of the loop (treated like an implicit prog)
  1907.  
  1908.  
  1909.  
  1910.  
  1911.  
  1912.  
  1913.  
  1914.  
  1915.  
  1916.  
  1917.  
  1918.  
  1919.  
  1920.  
  1921.  
  1922.  
  1923.  
  1924.  
  1925.  
  1926.  
  1927.  
  1928.  
  1929.  
  1930.  
  1931.  
  1932.  
  1933.  
  1934.  
  1935.  
  1936.  
  1937.  
  1938.  
  1939.  
  1940.  
  1941.  
  1942.  
  1943.         XLISP                 THE PROGRAM FEATURE                Page 30
  1944.  
  1945.  
  1946.         THE PROGRAM FEATURE
  1947.  
  1948.         (prog ([<binding>]...) [<expr>]...)  THE PROGRAM FEATURE
  1949.         (prog* ([<binding>]...) [<expr>]...)  PROG WITH SEQUENTIAL BINDING
  1950.             <binding>   the variable bindings each of which is either:
  1951.                         1)  a symbol (which is initialized to nil)
  1952.                         2)  a list whose car is a symbol and whose cadr
  1953.                                 is an initialization expression
  1954.             <expr>      expressions to evaluate or tags (symbols)
  1955.             returns     nil or the argument passed to the return function
  1956.  
  1957.         (go <sym>)  GO TO A TAG WITHIN A PROG CONSTRUCT
  1958.             <sym>       the tag (quoted)
  1959.             returns     never returns
  1960.  
  1961.         (return [<expr>])  CAUSE A PROG CONSTRUCT TO RETURN A VALUE
  1962.             <expr>      the value (defaults to nil)
  1963.             returns     never returns
  1964.  
  1965.         (prog1 <expr1> [<expr>]...)  EXECUTE EXPRESSIONS SEQUENTIALLY
  1966.             <expr1>     the first expression to evaluate
  1967.             <expr>      the remaining expressions to evaluate
  1968.             returns     the value of the first expression
  1969.  
  1970.         (prog2 <expr1> <expr2> [<expr>]...)  EXECUTE EXPRESSIONS SEQUENTIALLY
  1971.             <expr1>     the first expression to evaluate
  1972.             <expr2>     the second expression to evaluate
  1973.             <expr>      the remaining expressions to evaluate
  1974.             returns     the value of the second expression
  1975.  
  1976.         (progn [<expr>]...)  EXECUTE EXPRESSIONS SEQUENTIALLY
  1977.             <expr>      the expressions to evaluate
  1978.             returns     the value of the last expression (or nil)
  1979.  
  1980.  
  1981.  
  1982.  
  1983.  
  1984.  
  1985.  
  1986.  
  1987.  
  1988.  
  1989.  
  1990.  
  1991.  
  1992.  
  1993.  
  1994.  
  1995.  
  1996.  
  1997.  
  1998.  
  1999.  
  2000.  
  2001.  
  2002.  
  2003.  
  2004.  
  2005.  
  2006.  
  2007.  
  2008.  
  2009.         XLISP             DEBUGGING AND ERROR HANDLING           Page 31
  2010.  
  2011.  
  2012.         DEBUGGING AND ERROR HANDLING
  2013.  
  2014.         (error <emsg> [<arg>])  SIGNAL A NON-CORRECTABLE ERROR
  2015.             <emsg>      the error message string
  2016.             <arg>       the argument expression (printed after the message)
  2017.             returns     never returns
  2018.  
  2019.         (cerror <cmsg> <emsg> [<arg>])  SIGNAL A CORRECTABLE ERROR
  2020.             <cmsg>      the continue message string
  2021.             <emsg>      the error message string
  2022.             <arg>       the argument expression (printed after the message)
  2023.             returns     nil when continued from the break loop
  2024.  
  2025.         (break [<bmsg> [<arg>]])  ENTER A BREAK LOOP
  2026.             <bmsg>      the break message string (defaults to "**BREAK**")
  2027.             <arg>       the argument expression (printed after the message)
  2028.             returns     nil when continued from the break loop
  2029.  
  2030.         (clean-up)  CLEAN-UP AFTER AN ERROR
  2031.             returns     never returns
  2032.  
  2033.         (continue)  CONTINUE FROM A CORRECTABLE ERROR
  2034.             returns     never returns
  2035.  
  2036.         (errset <expr> [<pflag>])  TRAP ERRORS
  2037.             <expr>      the expression to execute
  2038.             <pflag>     flag to control printing of the error message
  2039.             returns     the value of the last expression consed with nil
  2040.                         or nil on error
  2041.  
  2042.         (baktrace [<n>])  PRINT N LEVELS OF TRACE BACK INFORMATION
  2043.             <n>         the number of levels (defaults to all levels)
  2044.             returns     nil
  2045.  
  2046.         (evalhook <expr> <ehook> <ahook> [<env>])  EVALUATE WITH HOOKS
  2047.             <expr>      the expression to evaluate
  2048.             <ehook>     the value for *evalhook*
  2049.             <ahook>     the value for *applyhook*
  2050.             <env>       the environment (default is nil)
  2051.             returns     the result of evaluating the expression
  2052.  
  2053.  
  2054.  
  2055.  
  2056.  
  2057.  
  2058.  
  2059.  
  2060.  
  2061.  
  2062.  
  2063.  
  2064.  
  2065.  
  2066.  
  2067.  
  2068.  
  2069.  
  2070.  
  2071.  
  2072.  
  2073.  
  2074.  
  2075.         XLISP                 ARITHMETIC FUNCTIONS               Page 32
  2076.  
  2077.  
  2078.         ARITHMETIC FUNCTIONS
  2079.  
  2080.         (truncate <expr>)  TRUNCATES A FLOATING POINT NUMBER TO AN INTEGER
  2081.             <expr>      the number
  2082.             returns     the result of truncating the number
  2083.  
  2084.         (float <expr>)  CONVERTS AN INTEGER TO A FLOATING POINT NUMBER
  2085.             <expr>      the number
  2086.             returns     the result of floating the integer
  2087.  
  2088.         (+ <expr>...)  ADD A LIST OF NUMBERS
  2089.             <expr>      the numbers
  2090.             returns     the result of the addition
  2091.  
  2092.         (- <expr>...)  SUBTRACT A LIST OF NUMBERS OR NEGATE A SINGLE NUMBER
  2093.             <expr>      the numbers
  2094.             returns     the result of the subtraction
  2095.  
  2096.         (* <expr>...)  MULTIPLY A LIST OF NUMBERS
  2097.             <expr>      the numbers
  2098.             returns     the result of the multiplication
  2099.  
  2100.         (/ <expr>...)  DIVIDE A LIST OF NUMBERS
  2101.             <expr>      the numbers
  2102.             returns     the result of the division
  2103.  
  2104.         (1+ <expr>)  ADD ONE TO A NUMBER
  2105.             <expr>      the number
  2106.             returns     the number plus one
  2107.  
  2108.         (1- <expr>)  SUBTRACT ONE FROM A NUMBER
  2109.             <expr>      the number
  2110.             returns     the number minus one
  2111.  
  2112.         (rem <expr>...)  REMAINDER OF A LIST OF NUMBERS
  2113.             <expr>      the numbers
  2114.             returns     the result of the remainder operation
  2115.  
  2116.         (min <expr>...)  THE SMALLEST OF A LIST OF NUMBERS
  2117.             <expr>      the expressions to be checked
  2118.             returns     the smallest number in the list
  2119.  
  2120.         (max <expr>...)  THE LARGEST OF A LIST OF NUMBERS
  2121.             <expr>      the expressions to be checked
  2122.             returns     the largest number in the list
  2123.  
  2124.         (abs <expr>)  THE ABSOLUTE VALUE OF A NUMBER
  2125.             <expr>      the number
  2126.             returns     the absolute value of the number
  2127.  
  2128.         (random <n>)  COMPUTE A RANDOM NUMBER BETWEEN 1 and N-1
  2129.             <n>         the upper bound (integer)
  2130.             returns     a random number
  2131.  
  2132.  
  2133.  
  2134.  
  2135.  
  2136.  
  2137.  
  2138.  
  2139.  
  2140.  
  2141.         XLISP                 ARITHMETIC FUNCTIONS               Page 33
  2142.  
  2143.  
  2144.         (sin <expr>)  COMPUTE THE SINE OF A NUMBER
  2145.             <expr>      the floating point number
  2146.             returns     the sine of the number
  2147.  
  2148.         (cos <expr>)  COMPUTE THE COSINE OF A NUMBER
  2149.             <expr>      the floating point number
  2150.             returns     the cosine of the number
  2151.  
  2152.         (tan <expr>)  COMPUTE THE TANGENT OF A NUMBER
  2153.             <expr>      the floating point number
  2154.             returns     the tangent of the number
  2155.  
  2156.         (expt <x-expr> <y-expr>)  COMPUTE X TO THE Y POWER
  2157.             <x-expr>    the floating point number
  2158.             <y-expr>    the floating point exponent
  2159.             returns     x to the y power
  2160.  
  2161.         (exp <x-expr>)  COMPUTE E TO THE X POWER
  2162.             <x-expr>    the floating point number
  2163.             returns     e to the x power
  2164.  
  2165.         (sqrt <expr>)  COMPUTE THE SQUARE ROOT OF A NUMBER
  2166.             <expr>      the floating point number
  2167.             returns     the square root of the number
  2168.  
  2169.  
  2170.  
  2171.  
  2172.  
  2173.  
  2174.  
  2175.  
  2176.  
  2177.  
  2178.  
  2179.  
  2180.  
  2181.  
  2182.  
  2183.  
  2184.  
  2185.  
  2186.  
  2187.  
  2188.  
  2189.  
  2190.  
  2191.  
  2192.  
  2193.  
  2194.  
  2195.  
  2196.  
  2197.  
  2198.  
  2199.  
  2200.  
  2201.  
  2202.  
  2203.  
  2204.  
  2205.  
  2206.  
  2207.         XLISP              BITWISE LOGICAL FUNCTIONS             Page 34
  2208.  
  2209.  
  2210.         BITWISE LOGICAL FUNCTIONS
  2211.  
  2212.         (bit-and <expr>...)  THE BITWISE AND OF A LIST OF NUMBERS
  2213.             <expr>      the numbers
  2214.             returns     the result of the and operation
  2215.  
  2216.         (bit-ior <expr>...)  THE BITWISE INCLUSIVE OR OF A LIST OF NUMBERS
  2217.             <expr>      the numbers
  2218.             returns     the result of the inclusive or operation
  2219.  
  2220.         (bit-xor <expr>...)  THE BITWISE EXCLUSIVE OR OF A LIST OF NUMBERS
  2221.             <expr>      the numbers
  2222.             returns     the result of the exclusive or operation
  2223.  
  2224.         (bit-not <expr>)  THE BITWISE NOT OF A NUMBER
  2225.             <expr>      the number
  2226.             returns     the bitwise inversion of number
  2227.  
  2228.  
  2229.  
  2230.  
  2231.  
  2232.  
  2233.  
  2234.  
  2235.  
  2236.  
  2237.  
  2238.  
  2239.  
  2240.  
  2241.  
  2242.  
  2243.  
  2244.  
  2245.  
  2246.  
  2247.  
  2248.  
  2249.  
  2250.  
  2251.  
  2252.  
  2253.  
  2254.  
  2255.  
  2256.  
  2257.  
  2258.  
  2259.  
  2260.  
  2261.  
  2262.  
  2263.  
  2264.  
  2265.  
  2266.  
  2267.  
  2268.  
  2269.  
  2270.  
  2271.  
  2272.  
  2273.         XLISP                 RELATIONAL FUNCTIONS               Page 35
  2274.  
  2275.  
  2276.         RELATIONAL FUNCTIONS
  2277.  
  2278.         The relational functions can be used to compare integers,
  2279.         floating point numbers or strings.
  2280.  
  2281.         (< <e1> <e2>)  TEST FOR LESS THAN
  2282.             <e1>        the left operand of the comparison
  2283.             <e2>        the right operand of the comparison
  2284.             returns     the result of comparing <e1> with <e2>
  2285.  
  2286.         (<= <e1> <e2>)  TEST FOR LESS THAN OR EQUAL TO
  2287.             <e1>        the left operand of the comparison
  2288.             <e2>        the right operand of the comparison
  2289.             returns     the result of comparing <e1> with <e2>
  2290.  
  2291.         (= <e1> <e2>)  TEST FOR EQUAL TO
  2292.             <e1>        the left operand of the comparison
  2293.             <e2>        the right operand of the comparison
  2294.             returns     the result of comparing <e1> with <e2>
  2295.  
  2296.         (/= <e1> <e2>)  TEST FOR NOT EQUAL TO
  2297.             <e1>        the left operand of the comparison
  2298.             <e2>        the right operand of the comparison
  2299.             returns     the result of comparing <e1> with <e2>
  2300.  
  2301.         (>= <e1> <e2>)  TEST FOR GREATER THAN OR EQUAL TO
  2302.             <e1>        the left operand of the comparison
  2303.             <e2>        the right operand of the comparison
  2304.             returns     the result of comparing <e1> with <e2>
  2305.  
  2306.         (> <e1> <e2>)  TEST FOR GREATER THAN
  2307.             <e1>        the left operand of the comparison
  2308.             <e2>        the right operand of the comparison
  2309.             returns     the result of comparing <e1> with <e2>
  2310.  
  2311.  
  2312.  
  2313.  
  2314.  
  2315.  
  2316.  
  2317.  
  2318.  
  2319.  
  2320.  
  2321.  
  2322.  
  2323.  
  2324.  
  2325.  
  2326.  
  2327.  
  2328.  
  2329.  
  2330.  
  2331.  
  2332.  
  2333.  
  2334.  
  2335.  
  2336.  
  2337.  
  2338.  
  2339.         XLISP                   STRING FUNCTIONS                 Page 36
  2340.  
  2341.  
  2342.         STRING FUNCTIONS
  2343.  
  2344.         (char <string> <index>)  EXTRACT A CHARACTER FROM A STRING
  2345.             <string>    the string
  2346.             <index>     the string index (zero relative)
  2347.             returns     the ascii code of the character
  2348.  
  2349.         (string <expr>)  MAKE A STRING FROM AN INTEGER ASCII VALUE
  2350.             <expr>      the integer
  2351.             returns     a one character string
  2352.  
  2353.         (strcat [<expr>]...)  CONCATENATE STRINGS
  2354.             <expr>      the strings to concatenate
  2355.             returns     the result of concatenating the strings
  2356.  
  2357.         (substr <expr> <sexpr> [<lexpr>]) EXTRACT A SUBSTRING
  2358.             <expr>      the string
  2359.             <sexpr>     the starting position
  2360.             <lexpr>     the length (default is rest of string)
  2361.             returns     substring starting at <sexpr> for <lexpr>
  2362.  
  2363.  
  2364.  
  2365.  
  2366.  
  2367.  
  2368.  
  2369.  
  2370.  
  2371.  
  2372.  
  2373.  
  2374.  
  2375.  
  2376.  
  2377.  
  2378.  
  2379.  
  2380.  
  2381.  
  2382.  
  2383.  
  2384.  
  2385.  
  2386.  
  2387.  
  2388.  
  2389.  
  2390.  
  2391.  
  2392.  
  2393.  
  2394.  
  2395.  
  2396.  
  2397.  
  2398.  
  2399.  
  2400.  
  2401.  
  2402.  
  2403.  
  2404.  
  2405.         XLISP                INPUT/OUTPUT FUNCTIONS              Page 37
  2406.  
  2407.  
  2408.         INPUT/OUTPUT FUNCTIONS
  2409.  
  2410.         (read [<source> [<eof> [<rflag>]]])  READ AN XLISP EXPRESSION
  2411.             <source>    the input source (default is standard input)
  2412.             <eof>       the value to return on end of file (default is nil)
  2413.             <rflag>     recursive read flag (default is nil)
  2414.             returns     the expression read
  2415.  
  2416.         (print <expr> [<sink>])  PRINT A LIST OF VALUES ON A NEW LINE
  2417.             <expr>      the expressions to be printed
  2418.             <sink>      the output sink (default is standard output)
  2419.             returns     the expression
  2420.  
  2421.         (prin1 <expr> [<sink>])  PRINT A LIST OF VALUES
  2422.             <expr>      the expressions to be printed
  2423.             <sink>      the output sink (default is standard output)
  2424.             returns     the expression
  2425.  
  2426.         (princ <expr> [<sink>])  PRINT A LIST OF VALUES WITHOUT QUOTING
  2427.             <expr>      the expressions to be printed
  2428.             <sink>      the output sink (default is standard output)
  2429.             returns     the expression
  2430.  
  2431.         (terpri [<sink>])  TERMINATE THE CURRENT PRINT LINE
  2432.             <sink>      the output sink (default is standard output)
  2433.             returns     nil
  2434.  
  2435.         (flatsize <expr>)  LENGTH OF PRINTED REPRESENTATION USING PRIN1
  2436.             <expr>      the expression
  2437.             returns     the length
  2438.  
  2439.         (flatc <expr>)  LENGTH OF PRINTED REPRESENTATION USING PRINC
  2440.             <expr>      the expression
  2441.             returns     the length
  2442.  
  2443.  
  2444.  
  2445.  
  2446.  
  2447.  
  2448.  
  2449.  
  2450.  
  2451.  
  2452.  
  2453.  
  2454.  
  2455.  
  2456.  
  2457.  
  2458.  
  2459.  
  2460.  
  2461.  
  2462.  
  2463.  
  2464.  
  2465.  
  2466.  
  2467.  
  2468.  
  2469.  
  2470.  
  2471.         XLISP                  FILE I/O FUNCTIONS                Page 38
  2472.  
  2473.  
  2474.         FILE I/O FUNCTIONS
  2475.  
  2476.         (openi <fname>)  OPEN AN INPUT FILE
  2477.             <fname>     the file name string or symbol
  2478.             returns     a file pointer
  2479.  
  2480.         (openo <fname>)  OPEN AN OUTPUT FILE
  2481.             <fname>     the file name string or symbol
  2482.             returns     a file pointer
  2483.  
  2484.         (close <fp>)  CLOSE A FILE
  2485.             <fp>        the file pointer
  2486.             returns     nil
  2487.  
  2488.         (read-char [<source>])  READ A CHARACTER FROM A FILE OR STREAM
  2489.             <source>    the input source (default is standard input)
  2490.             returns     the character (integer)
  2491.  
  2492.         (peek-char [<flag> [<source>]])  PEEK AT THE NEXT CHARACTER
  2493.             <flag>      flag for skipping white space (default is nil)
  2494.             <source>    the input source (default is standard input)
  2495.             returns     the character (integer)
  2496.  
  2497.         (write-char <ch> [<sink>])  WRITE A CHARACTER TO A FILE OR STREAM
  2498.             <ch>        the character to put (integer)
  2499.             <sink>      the output sink (default is standard output)
  2500.             returns     the character (integer)
  2501.  
  2502.         (read-line [<source>])  READ A LINE FROM A FILE OR STREAM
  2503.             <source>    the input source (default is standard input)
  2504.             returns     the input string
  2505.  
  2506.  
  2507.  
  2508.  
  2509.  
  2510.  
  2511.  
  2512.  
  2513.  
  2514.  
  2515.  
  2516.  
  2517.  
  2518.  
  2519.  
  2520.  
  2521.  
  2522.  
  2523.  
  2524.  
  2525.  
  2526.  
  2527.  
  2528.  
  2529.  
  2530.  
  2531.  
  2532.  
  2533.  
  2534.  
  2535.  
  2536.  
  2537.         XLISP                   SYSTEM FUNCTIONS                 Page 39
  2538.  
  2539.  
  2540.         SYSTEM FUNCTIONS
  2541.  
  2542.         (load <fname> [<vflag> [<pflag>]])  LOAD AN XLISP SOURCE FILE
  2543.             <fname>     the filename string or symbol
  2544.             <vflag>     the verbose flag (default is t)
  2545.             <pflag>     the print flag (default is nil)
  2546.             returns     the filename
  2547.  
  2548.         (gc)  FORCE GARBAGE COLLECTION
  2549.             returns     nil
  2550.  
  2551.         (expand <num>)  EXPAND MEMORY BY ADDING SEGMENTS
  2552.             <num>       the number of segments to add
  2553.             returns     the number of segments added
  2554.  
  2555.         (alloc <num>)  CHANGE NUMBER OF NODES TO ALLOCATE IN EACH SEGMENT
  2556.             <num>       the number of nodes to allocate
  2557.             returns     the old number of nodes to allocate
  2558.  
  2559.         (mem)  SHOW MEMORY ALLOCATION STATISTICS
  2560.             returns     nil
  2561.  
  2562.         (type-of <expr>)  RETURNS THE TYPE OF THE EXPRESSION
  2563.             <expr>      the expression to return the type of
  2564.             returns     nil if the value is nil otherwise one of the symbols:
  2565.                           :SYMBOL for symbols
  2566.                           :OBJECT for objects
  2567.                           :CONS   for conses
  2568.                           :SUBR   for built-ins with evaluated arguments
  2569.                           :FSUBR  for built-ins with unevaluated arguments
  2570.                           :STRING for strings
  2571.                           :FIXNUM for integers
  2572.                           :FLONUM for floating point numbers
  2573.                           :FILE   for file pointers
  2574.                           :ARRAY  for arrays
  2575.  
  2576.         (exit)  EXIT XLISP
  2577.             returns     never returns
  2578.  
  2579.  
  2580.  
  2581.  
  2582.  
  2583.  
  2584.  
  2585.  
  2586.  
  2587.  
  2588.  
  2589.  
  2590.  
  2591.  
  2592.  
  2593.  
  2594.  
  2595.  
  2596.  
  2597.  
  2598.  
  2599.  
  2600. SHAR_EOF
  2601. fi # end of overwriting check
  2602. #    End of shell archive
  2603. exit 0
  2604.